<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <a href="#">支付在5秒后跳转页面</a>

    <script>
        // 1.获取元素
        const a = document.querySelector('a')
        let num = 5
        let timerId = setInterval(function () {
            num--
            a.innerHTML = `支付在${num}秒后跳转页面`
            if (num === 0) {
                clearInterval(timerId)
                location.href = 'https://www.baidu.com/'
            }
        }, 1000)
    </script>
</body>

</html>